package cn.csc.module.product.api.category;

import cn.csc.framework.common.pojo.CommonResult;
import cn.csc.module.product.api.category.dto.CategoryRespDTO;
import cn.csc.module.product.enums.ApiConstants;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigInteger;
import java.util.Collection;
import java.util.List;

/**
 * @author liuchuang
 * @version 1.0
 * @date 2024/1/3 16:39
 * @modify
 */
@FeignClient(name = ApiConstants.NAME) // TODO fallbackFactory =
@Api(tags = "RPC 服务 - 商品类目")
public interface CategoryApi {

    String PREFIX = ApiConstants.PREFIX + "/product";


    @GetMapping(PREFIX + "/category/listByOneLevel")
    @ApiOperation("获取所有一级分类信息")
    CommonResult<List<CategoryRespDTO>> listByOneLevel();


    @GetMapping(value = PREFIX + "/category/listCategoryId")
    @ApiOperation("根据上级id，获取子分类id列表")
    @ApiImplicitParam(name = "categoryId", value = "分类id", example = "102421", required = true, dataTypeClass = BigInteger.class)
    CommonResult<List<BigInteger>> listCategoryId(@RequestParam("categoryId") BigInteger categoryId);

    @GetMapping(value = PREFIX + "/category/listByids")
    @ApiOperation("根据类目ID查询集合")
    @ApiImplicitParam(name = "ids", value = "分类id", example = "102421", required = true, dataTypeClass = Collection.class)
    CommonResult<List<CategoryRespDTO>> listCategoryIds(@RequestParam("ids") Collection<BigInteger> ids);

}
